home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / Libraries / VideoToolbox 97.08.16 / VideoToolboxSources / Zoom.c < prev   
Encoding:
C/C++ Source or Header  |  1997-04-10  |  1.7 KB  |  45 lines  |  [TEXT/CWIE]

  1. /*
  2. Zoom.c 
  3. 10/17/90    dgp    translated from pascal DoWZoom.p in Inside Mac VI.
  4. 10/18/90 dgp    removed part of the code to make GetWindowDevice(), which I put
  5.                 in GetScreenDevice.c
  6. 8/24/91    dgp        Made compatible with THINK C 5.0.
  7. 12/27/91 dgp    Extracted code to create TitleBarHeight.c
  8. 3/26/92    dgp        Replaced use of SysEnvirons() by a call to QD8Exists().
  9. 6/3/94    dgp    replaced low-memory global MBarHeight by GetMBarHeight().
  10. 6/12/94    dgp    changed "theEvent" from a global to an argument "event", passed by address.
  11. 4/10/97    dgp    Eliminate stuff that was conditional on !UNIVERSAL_HEADERS.
  12. */
  13. #include "VideoToolbox.h"
  14. #include <LowMem.h>        // LMGetMBarHeight,LMSetMBarHeight
  15.  
  16. void Zoom(WindowPtr theWindow,int zoomDir,EventRecord *event)
  17. {
  18.     Rect r;
  19.     GDHandle dominantGDevice;
  20.     int headRoom;
  21.     GrafPtr savePort;
  22.     
  23.     if(TrackBox(theWindow,event->where,zoomDir)){
  24.         GetPort(&savePort);
  25.         SetPort(theWindow);
  26.         EraseRect(&theWindow->portRect);        /*recommended for cosmetic reasons*/
  27.         /* If there is the possibility of multiple gDevices, then we */
  28.         /* must check them to make sure we are zooming onto the right */
  29.         /* display device when zooming out. */
  30.         if(zoomDir==inZoomOut && QD8Exists()){
  31.             headRoom=TitleBarHeight(theWindow);
  32.             /* We must create a zoom rectangle manually in this case. */
  33.             /* Account for menu bar height as well, if on main device */
  34.             dominantGDevice=GetWindowDevice(theWindow);
  35.             if(dominantGDevice==GetMainDevice()) headRoom += LMGetMBarHeight();
  36.             r=(*dominantGDevice)->gdRect;
  37.             SetRect(&r,r.left+3,r.top+headRoom+3,r.right-3,r.bottom-3);
  38.             /* Set up the WStateData record for this window. */
  39.             (*((WStateData **)((WindowPeek)theWindow)->dataHandle))->stdState = r;
  40.         }
  41.         ZoomWindow(theWindow,zoomDir,TRUE);
  42.         SetPort(savePort);
  43.     }
  44. }
  45.